//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __RBUF_H_
#define __RBUF_H_

typedef struct _MT_RBUF_ {
    UCHAR*     pData;
    UINT       cbSize;
    UINT       cbType;
    UINT       cbWrite;
    UINT       dwIndex;
    DzMutex      Lock;
} MT_RBUF, *PMT_RBUF;

typedef struct _RBUF_ {
    UCHAR* pData;
    UINT   cbSize;
    UINT   cbType;
    UINT   dwWtIdx;//index attemp to write @For Reset This Index Set To 1
    UINT   dwRdIdx;//index last read       @For Reset This Index Set To 0
} RBUF, *PRBUF;

EXTERN_C BOOL RBUF_MT_Init(PMT_RBUF pr, int cbSize, int cbType);
EXTERN_C void RBUF_MT_DeInit(PMT_RBUF pr);
EXTERN_C void RBUF_MT_Reset(PMT_RBUF pr);
EXTERN_C UINT RBUF_MT_EnQueue(PMT_RBUF pr, UCHAR *pData, UINT cbData);
EXTERN_C UINT RBUF_MT_DeQueue(PMT_RBUF pr, UCHAR *pData, UINT cbData);

EXTERN_C BOOL RBUF_Init(PRBUF pr, int cbSize, int cbType);
EXTERN_C void RBUF_DeInit(PRBUF pr);
EXTERN_C void RBUF_Reset(PRBUF pr);
EXTERN_C BOOL RBUF_IsEmpty(PRBUF pr);
EXTERN_C UINT RBUF_EnQueue(PRBUF pr, UCHAR *pData, UINT cbData);
EXTERN_C UINT RBUF_DeQueue(PRBUF pr, UCHAR *pData, UINT cbData);

#endif
